package com.qqtech.qquan.order.dao;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.qqtech.core.common.util.BeanUtil;
import com.qqtech.core.frame.dao.BaseDaoImpl;
import com.qqtech.qquan.order.model.OrderPayLog;
import com.qqtech.qquan.order.model.OrderPayLogQuery;
import com.qqtech.qquan.order.model.OrderPayLogVo;

@Repository
public class OrderPayLogDaoImpl extends BaseDaoImpl<OrderPayLog> implements OrderPayLogDao {
	public static final Logger log = LoggerFactory.getLogger(OrderPayLogDaoImpl.class);
	
	public OrderPayLog getByPayOrderNo(java.lang.String payOrderNo) {
		return sqlSessionTemplate.selectOne(getSqlName("selectByPayOrderNo"), payOrderNo);
	}
	
	@Override
	public int queryCountAdmin(OrderPayLogQuery query) {
		return sqlSessionTemplate.selectOne(getSqlName("selectCountAdmin"), BeanUtil.toMap(query));
	}

	@Override
	public Page<OrderPayLogVo> queryPageListAdmin(OrderPayLogQuery query, Pageable pageable) {
		List<OrderPayLogVo> contentList = sqlSessionTemplate.selectList(getSqlName("selectAdmin"), getParams(query, pageable));
		return new PageImpl<OrderPayLogVo>(contentList, pageable, this.queryCountAdmin(query));
	}

	@Override
	public List<OrderPayLogVo> queryListAdmin(OrderPayLogQuery query, Pageable pageable) {
		return sqlSessionTemplate.selectList(getSqlName("selectAdmin"), getParams(query, pageable));
	}
}
